﻿using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;
using XNode;

namespace BearUtil.Hidden
{
    /// <summary>
    /// 自定义拓展节点
    /// 服务于 Dialog 节点，提供额外的属性编辑
    /// </summary>
    public class BearPrefix : BearNode
    {
        [Sirenix.OdinInspector.ReadOnly]
        public int id;
        
        // 连接子节点要求
        public override void OnCreateConnection(NodePort @from, NodePort to)
        {
            // 创建链接节点需求时
            var dn = to.node as BearDialog;
            if (to.node != this)
            {
                if (dn == null)
                {
                    Debug.LogError("链接警告，prefix 只能接受 DialogNode！");
                    to.ClearConnections();
                }                
            }
        }
    }
}
